<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    //创建复杂的符合对象  比如应聘者
    //创建人
    var Human = function (param) {
      // 创建技能
      this.skill = param && param.skill || '保密';
      // 创建嗜好
      this.hobby = param && param.hobby || '保密';
    }
    // 人类原型方法
    Human.prototype = {
      getSkill: function () {
        return this.skill;
      },
      getHobby: function () {
        return this.hobby;
      }
    }
    // 实例化姓名类
    var Named = function (name) {
      var self = this;
      // 解析姓和名
      (function (name, self) {
        self.name = name;
        if (name.indexOf(" ") !== -1) {
          self.firstName = name.slice(0, name.indexOf(" "));
          self.lastName = name.slice(name.indexOf(" "))
        }
      })(name, self)
    }
  </script>
</body>

</html>